#include"processbar.h"

#include<unistd.h>

//tmpypedef void (*ProBar)(double,double);

void Download(double bandwidth,double filesize)
{
  static int cnt = 0;
  cnt++;
  printf("开始下载文件%d\n",cnt);
  double current = 0;

  while(current <= filesize)
  {
    ProBar(current,filesize);
    current += bandwidth;
  
    usleep(1000); 
  }

  printf("\ncompleted!\n");
}

int main()
{
  Download(1024*1024*0.5,200*1024*1024);
  Download(1024*1024*1,700*1024*1024);
  Download(1024*1024*0.2,1000*1024*1024);
  Download(1024*1024*1,500*1024*1024);
  Download(1024*1024*0.25,100*1024*1024);
  
  
  return 0;
}
